(function (open, send) {
  let version = new URLSearchParams(window.location.search).get("20231105");
  if (window.location.href.indexOf("localhost") < 0) {
    if (version) {
      sessionStorage.setItem("20231105", version);
      return window.location.replace("/test2/index.html?t=" + version);
    } else {
      version = sessionStorage.getItem("20231105");
      if (!version) {
        return window.location.replace(
          "https://mp.weixin.qq.com/s?__biz=MzkxODUyODQ1Mg==&mid=2247483675&idx=1&sn=3ea6a84f6bd1528fdcd0f5cf3d2fd92d&chksm=c1b149b0f6c6c0a6637a404df7a21e503e5d0338145283f711ec2b4f1d43844181f4cee1585e#rd"
        );
      }
    }
  }

  let staticHost = window.location.origin;
  if (window.location.href.indexOf("localhost") < 0) {
    // staticHost = "https://xwuyazuofeijix.gitee.io/storage2";
  }
  const nativeScriptSet = Object.getOwnPropertyDescriptor(
    HTMLScriptElement.prototype,
    "src"
  ).set;
  Object.defineProperty(HTMLScriptElement.prototype, "src", {
    set: function (url) {
      if (url && url.startsWith("http")) {
        nativeScriptSet.call(this, url);
      } else {
        nativeScriptSet.call(
          this,
          staticHost + window.location.pathname + "/../" + url
        );
      }
    },
  });
  const createScript = function (url) {
    let script = document.createElement("script");
    script.src = url;
    script.type = "text/javascript";
    script.onload = function () {
      if (
        window.uni &&
        window.uni.getStorageSync &&
        !window.uni.getStorageSyncOverwrite
      ) {
        uni.getStorageSyncOverwrite = true;
        const getStorageSync = uni.getStorageSync;
        uni.getStorageSync = function (key) {
          if (key === "unionId" || key === "openid") {
            return "999999999";
          }
          return getStorageSync(key);
        };
      }
    };
    document.body.appendChild(script);
  };
  createScript("./static/js/chunk-vendors.bb34b270.js?t=" + version);
  createScript("./static/js/index.c2955a7b.js");
  createScript("./static/js/index.c2955a8b.js");

  const style = document.createElement("style");
  style.innerHTML = `
  			  .allPage .zfSuccessToast {
  			  	display: none;
  			  }
  			  .allPage .zfSuccessToastPhone{
  			  	display: none;
  			  }
			  .image-cropper{
				  z-index:9999;
			  }
			  .page .openQunRWM .qunImg {
			      // display: none;
				  visibility: hidden;
			  }
  			`;
  document.head.appendChild(style);
  XMLHttpRequest.prototype.open = function (
    method,
    url,
    async,
    user,
    password
  ) {
    if (window.location.href.indexOf("localhost") < 0) {
      for (let index = 0; index < arguments.length; index++) {
        if (arguments[index] === "https://api.next.bspapp.com/client") {
          arguments[index] =
            "https://fc-mp-b873efaa-bfc5-42b5-8eea-a3b53c6e54d6.next.bspapp.com/client";
        }
      }
    }
    open.apply(this, arguments);
  };
  XMLHttpRequest.prototype.send = function (data) {
    this.addEventListener(
      "readystatechange",
      function () {
        if (
          this.readyState === 4 &&
          this.responseURL.indexOf(
            "https://fc-mp-b873efaa-bfc5-42b5-8eea-a3b53c6e54d6.next.bspapp.com/client"
          ) > -1
        ) {
          const requestData = JSON.parse(data);

          let response = null;
          if (
            requestData.method === "serverless.auth.user.anonymousAuthorize"
          ) {
            response = {
              success: true,
              data: {
                accessToken: "8599f9db-0315-40c2-a6dd-c83c6beaf8b3",
                expiresInSecond: 600,
              },
            };
          } else if (
            requestData.method === "serverless.function.runtime.invoke"
          ) {
            const params = JSON.parse(requestData.params);
            if (
              params.functionArgs.command.$db[0].$method === "collection" &&
              params.functionArgs.command.$db[0].$param[0] === "appNewVersion"
            ) {
              response = {
                success: true,
                data: {
                  code: 0,
                  errCode: 0,
                  message: "",
                  errMsg: "",
                  systemInfo: [],
                  affectedDocs: 1,
                  data: [
                    {
                      _id: "63a3fd89f5cf3ae96e789a59",
                      content:
                        "本次更新:<br>1. 新加银行交易提醒<br>2. 修复了聊天动画时转账已接收问题<br>3. 修复了部分已知bug",
                      toast: false,
                      version: "130",
                      downLoadUrl:
                        "https://wechatextension-1258510461.cos.ap-nanjing.myqcloud.com/wxUitl/appUpdate/zqmn.wgt",
                      downLoadUrlIos:
                        "https://wechatextension-1258510461.cos.ap-nanjing.myqcloud.com/wxUitl/appUpdate/zqmn.wgt",
                      toastInfo:
                        "<p>请大家使用前先进群！！！</p><p>请大家使用前先进群！！！</p><p>请大家使用前先进群！！！</p><p><text class='nextModes' style='color: #ff2946;font-weight: bold;'>小程序近期会停服更换</text><text>进群可以永远找到回家的路,可以永远免费使用</text></p><p style='margin-top: 2px;'><text>官方微信交流群</text><button @click='openQun' style='width: 100px;padding: 0;margin:0; height: 30px;line-height: 30px;font-size: 12px;border: none;box-shadow: none;background-color: #f2f4f8;color: #606266; display: inline-block;vertical-align: middle;margin-left: 10px;text-align: right;padding-right: 12px;'><image src='../../static/kf.svg' mode='widthFix' style='width: 20px;position: absolute;top: 5px;margin-left: -20px;'></image><text class='nextMode' style='font-weight: bold;'>进入交流群</text></button></p>",
                      wxModuels: "wx93eacaf1db8b0dd0",
                    },
                  ],
                },
                header: {
                  "x-serverless-request-id": "ac1cc2f81699160862148185565",
                  "x-serverless-runtime-version": "2.0.6",
                  "x-fc-code-checksum": "4398124040086416443",
                  "access-control-expose-headers":
                    "Date,x-fc-request-id,x-fc-error-type,x-fc-code-checksum,x-fc-invocation-duration,x-fc-max-memory-usage,x-fc-log-result,x-fc-invocation-code-version,x-fc-instance-id",
                  "x-fc-invocation-service-version": "LATEST",
                  "x-fc-instance-id": "c-65470b5d-44bd18b596ef4b06b0ac",
                  "content-length": "1577",
                  date: "Sun, 05 Nov 2023 05:07:42 GMT",
                  "x-fc-request-id": "1-6547231e-96312826691f7d2c398977dc",
                  "x-fc-max-memory-usage": "51.94",
                  "x-fc-invocation-duration": "32",
                  "content-type": "application/octet-stream",
                  "x-serverless-http-status": "200",
                },
              };
            } else if (
              params.functionArgs.command.$db[0].$method === "collection" &&
              params.functionArgs.command.$db[0].$param[0] === "ty106"
            ) {
              response = {
                success: true,
                data: {
                  code: 0,
                  errCode: 0,
                  message: "",
                  errMsg: "",
                  systemInfo: [],
                  affectedDocs: 1,
                  data: [
                    {
                      _id: "63aa5351f43e60261d2e5fd5",
                      version: 0,
                    },
                  ],
                },
                header: {
                  "x-serverless-request-id": "ac1cd3621699164265589186875",
                  "x-serverless-runtime-version": "2.0.6",
                  "x-fc-code-checksum": "4398124040086416443",
                  "access-control-expose-headers":
                    "Date,x-fc-request-id,x-fc-error-type,x-fc-code-checksum,x-fc-invocation-duration,x-fc-max-memory-usage,x-fc-log-result,x-fc-invocation-code-version,x-fc-instance-id",
                  "x-fc-invocation-service-version": "LATEST",
                  "x-fc-instance-id": "c-65472411-d6494a05a88c401994ba",
                  "content-length": "285",
                  date: "Sun, 05 Nov 2023 06:04:25 GMT",
                  "x-fc-request-id": "1-65473069-507a18ec3f1826256a88f6f0",
                  "x-fc-max-memory-usage": "36.29",
                  "x-fc-invocation-duration": "24",
                  "content-type": "application/octet-stream",
                  "x-serverless-http-status": "200",
                },
              };
            } else if (
              params.functionArgs.command.$db[0].$method === "collection" &&
              params.functionArgs.command.$db[0].$param[0] === "objList"
            ) {
              response = {
                success: true,
                data: {
                  code: 0,
                  errCode: 0,
                  message: "",
                  errMsg: "",
                  systemInfo: [],
                  affectedDocs: 0,
                  data: [],
                },
                header: {
                  "x-serverless-request-id": "ac1cd3731699237503767199828",
                  "x-serverless-runtime-version": "2.0.6",
                  "x-fc-code-checksum": "4398124040086416443",
                  "access-control-expose-headers":
                    "Date,x-fc-request-id,x-fc-error-type,x-fc-code-checksum,x-fc-invocation-duration,x-fc-max-memory-usage,x-fc-log-result,x-fc-invocation-code-version,x-fc-instance-id",
                  "x-fc-invocation-service-version": "LATEST",
                  "x-fc-instance-id": "c-65483fe9-ba41c0373ced4d33a09a",
                  "content-length": "239",
                  date: "Mon, 06 Nov 2023 02:25:03 GMT",
                  "x-fc-request-id": "1-65484e7f-01b37c37af98905675798ea1",
                  "x-fc-max-memory-usage": "38.21",
                  "x-fc-invocation-duration": "25",
                  "content-type": "application/octet-stream",
                  "x-serverless-http-status": "200",
                },
              };
            } else if (
              params.functionArgs.command.$db[0].$method === "collection" &&
              params.functionArgs.command.$db[0].$param[0] === "wxuser"
            ) {
              response = {
                success: true,
                data: {
                  affectedDocs: 1,
                  data: [
                    {
                      _id: Date.now(),
                      gGokTimehm: Date.now() + 999999999,
                    },
                  ],
                },
              };
            }
          }
          if (response) {
            response = JSON.stringify(response);
            Object.defineProperty(this, "response", { value: response });
            Object.defineProperty(this, "responseText", { value: response });
          }
        }
      },
      false
    );

    send.apply(this, arguments);
  };

  const nativeImageSet = Object.getOwnPropertyDescriptor(
    Image.prototype,
    "src"
  ).set;
  Object.defineProperty(Image.prototype, "src", {
    set: function (url) {
      if (
        url ===
        "https://wechatextension-1258510461.cos.ap-nanjing.myqcloud.com/wxUtilJiaGuNew/static/image/qun.png"
      ) {
        url = staticHost + "/wxUtilJiaGuNew/static/image/qun.png";
        setTimeout(() => {
          let imgElement = document.createElement("img");
          imgElement.src = url;
          imgElement.style = "width:200px;height:200px;margin-top:50px;";
          const divElement = document.getElementsByClassName("openQunRWM")[0];
          divElement.insertBefore(imgElement, divElement.firstChild);
          document.getElementsByClassName("qunImg")[0].remove();
        }, 300);
      }

      setTimeout(() => {
        let ele = document.getElementsByClassName("srcImage");
        if (
          ele &&
          (ele = ele[0]) &&
          ele.src ===
            "https://wechatextension-1258510461.cos.ap-nanjing.myqcloud.com/wxUtilJiaGuNew/myLogo/xcx.jpg"
        ) {
          ele.src = staticHost + "/wxUtilJiaGuNew/myLogo/xcx.jpg";
        }

        if (uni.previewImage && !uni.previewImageRewrite) {
          uni.previewImageRewrite = true;
          const previewImage = uni.previewImage;
          uni.previewImage = function (options) {
            options.urls.forEach((url, index) => {
              if (
                url ===
                "https://wechatextension-1258510461.cos.ap-nanjing.myqcloud.com/wxUtilJiaGuNew/myLogo/xcx.jpg"
              ) {
                options.urls[index] =
                  staticHost + "/wxUtilJiaGuNew/myLogo/xcx.jpg";
              }
            });
            previewImage(options);
          };
        }
      }, Math.random() * 100 + 500);
      nativeImageSet.call(this, url);
    },
  });
  document.addEventListener("click", function (event) {
    setTimeout(() => {
      let ele = document.getElementsByClassName("srcImage");
      if (
        ele &&
        (ele = ele[0]) &&
        ele.src ===
          "https://wechatextension-1258510461.cos.ap-nanjing.myqcloud.com/wxUtilJiaGuNew/myLogo/xcx.jpg"
      ) {
        ele.src = staticHost + "/wxUtilJiaGuNew/myLogo/xcx.jpg";
      }
    }, Math.random() * 100 + 500);
  });
})(XMLHttpRequest.prototype.open, XMLHttpRequest.prototype.send);
